
package com.cluedo;

import java.util.ArrayList;
import java.util.List;

public class Player {
    int id;
    int weaponCategoryCnt = 0;
    int roomCategoryCnt = 0;
    int charCategoryCnt = 0;

    ArrayList<String> cards;
    DataGrid userGrid;

    public Player(final int tokenName) {
        this.id = tokenName;
        this.cards = new ArrayList<String>(9);
    }

    public void addToken(String cardToken) {
        cards.add(cardToken);
    }

    public List<String> getTokens() {
        return cards;
    }

    public void setDataGrid(DataGrid grid) {
        userGrid = grid;
    }

    public String showTokens() {
        StringBuilder sb = new StringBuilder();
        sb.append(String.format("Player %d\t", id));
        for (String tk : cards) {
            sb.append(String.format("%8s\t", tk));
        }
        return sb.toString();
    }

    public String toString() {
        return String.format("Plyr:%d\tChara:%d\tRoom:%d\tWeap:%d\tTot:%d",
                id, charCategoryCnt, roomCategoryCnt, weaponCategoryCnt,
                charCategoryCnt + roomCategoryCnt + weaponCategoryCnt);
    }

}
